import fetch from '@/common/utils/http'

/* 获取表头 */
export const getHeader = () =>
  fetch({
    url: '/crm/action/customer/config/header',
    method: 'GET',
    params: {}
  })

/* 更新表头 */
export const updateHeader = (data: any) =>
  fetch({
    url: '/crm/action/customer/config/header',
    method: 'POST',
    data
  })

/* 客户列表 */
export const cusList = (data: any) =>
  fetch({
    url: '/crm/action/customer/list',
    method: 'POST',
    data
  })

/* 客户详情 */
export const cusDetail = (id: any) =>
  fetch({
    url: `/crm/action/customer/${id}`,
    method: 'GET',
    params: {}
  })

/* 创建客户 */
export const addCus = (data: any) =>
  fetch({
    url: '/crm/action/customer/add',
    method: 'POST',
    data
  })

/* 更新客户 */
export const updateCus = (data: any) =>
  fetch({
    url: '/crm/action/customer/update',
    method: 'POST',
    data
  })

/* 删除客户 */
export const delCus = (data: any) =>
  fetch({
    url: '/crm/action/customer/delete',
    method: 'POST',
    data
  })

/* 分配客户 */
export const disCus = (data: any) =>
  fetch({
    url: '/crm/action/customer/saveCustomerByAssign',
    method: 'POST',
    data
  })

/* 批量删除 */
export const batchDel = (data: any) =>
  fetch({
    url: '/crm/action/customer/batchDelete',
    method: 'POST',
    data
  })

/* 批量分配 */
export const batchDis = (data: any) =>
  fetch({
    url: '/crm/action/customer/batchSaveCustomerByAssign',
    method: 'POST',
    data
  })

/* 客户动态 */
export const getDynamic = (data: any) =>
  fetch({
    url: '/crm/action/dynamics/query',
    method: 'POST',
    data
  })

/* 跟进记录 */
export const saveFollow = (data: any) =>
  fetch({
    url: '/crm/action/dynamics/insert',
    method: 'POST',
    data
  })

/* 删除跟进记录 */
export const delFollow = (data: any) =>
  fetch({
    url: '/crm/action/dynamics/delete',
    method: 'POST',
    data
  })

/* 操作日志 */
export const opeLog = (data: any) =>
  fetch({
    url: '/crm/action/operateLog/list',
    method: 'POST',
    data
  })

/* 高级检索-新建/更新常用检索 */
export const addAdvanced = (data: any) =>
  fetch({
    url: '/crm/action/customer/config/quickSearch/saveOrUpdate',
    method: 'POST',
    data
  })

/* 高级检索-删除常用检索 */
export const delAdvanced = (data: any) =>
  fetch({
    url: '/crm/action/customer/config/quickSearch/delete',
    method: 'POST',
    data
  })

/* 高级检索-获取常用检索 */
export const getAdvanced = (data: any) =>
  fetch({
    url: '/crm/action/customer/config/quickSearch',
    method: 'POST',
    data
  })

/* 高级检索-客户列表 */
export const advancedList = (data: any) =>
  fetch({
    url: '/crm/action/customer/advancedSearch',
    method: 'POST',
    data
  })
